home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
mpmod160.zip
/
SOURCE.ZIP
/
SOURCE.DOC
< prev
next >
Wrap
Text File
|
1994-01-01
|
10KB
|
206 lines
This document describes implementation by MpModem of special compression,
large blocks and fast modes.
The compression mode is an adaptation of Richard B. Johnson's Jmodem
compression which is both fast and small. The overhead placed on Zmodem is
minimal but people may experience slower than optimum speeds on rather slow
machines. The compression method bears NO resemblance to Chuck Forsberg's
"RLE" type compression which is copyright to that person. See MPMODEM.DOC
for full details of how you can include this source in your code for free.
The large block mode allows you to transfer files with large blocks of data
than the normal maximum of 1024 bytes. This could in some cases speed up
the transfer of files. The benefits are small but may be worthwhile in your
application. This is copyright, but is able to be used in your programs.
See MPMODEM.DOC for full details of how you can include this source in your
code for free.
The fast mode is an adaptation of Personalized Computer Programming Company
"PC²" with one significant difference. PC²'s implementation utilises
variable length headers which are purportedly the copyright material of
Chuck Forsberg. Given this, I have adapted this process to not use variable
length headers. See MPMODEM.DOC for full details of how you can include
this source in your code for free.
There are various files included in this archive. All these files are
designed only to show programmers the way to change their implementation of
Zmodem to use the above enhancements.
The files are:
Z-RX.C - Contains all the receive specific routines required by
Zmodem. Only the routines applicable to the above
modifications are contained.
Z-TX.C - Contains all the send specific routines required by
Zmodem. Only the routines applicable to the above
modifications are contained.
Z-GEN.C - Contains all of the miscellaneous routines used by
Zmodem. Only routines applicable to the above
modifications are contained.
Z-GEN.H - Contains Zmodem defines and masks used to determine such
things as whether the remote can send/receive in fast
and/or compressed mode and so on.
COMPRESS.C - Contains the compression and decompression routines.
COMPRESS.H - Header file for inclusion in Z-RX.C and Z-TX.C (if
required).
Rather than explain all the nuts and bolts of the two methods, I will leave
that to the code. I will explain the main variables though:
Variable
Name Description
------------------------------------------------------------------------
RxType
Current type of transmission being received. These values
are established when the receiver receives a header. The
possible values are:
0 - Binary (with CRC-16) and Hex headers.
1 - Binary (with CRC-32).
2 - Not used (next release).
3 - Binary compressed (with CRC-32).
4 - Binary compressed (with CRC-16).
TxType Current type of transmission being sent. These values are
established by what you want (compression, FAST etc) and
what the receiver says it wants. It is reinstated from
TxMaster when you send a binary header. This allows the
binary transmission to be sent in the mode negotiated at
startup.
TxMaster This is the transfer type master flag which is negotiated
at startup with the receiver. This value is used to
reinstate the transfer type after it has changed (when a
hex header has been sent). Possible values are the same
as RxType. (see above)
TryComp This is a flag which is set depending on the command line
options. In MpModem's case, it is set when MpModem is
invoked with "-c".
TryFast This is a flag which is set depending on the command line
options. In MpModem's case, it is set when MpModem is
invoked with "-f".
TryBig This is a flag which is set depending on the command line
options. In MpModem's case, it is set when MpModem is
invoked with the "-l" switch.
WantComp In send mode:
Receiver has said it wants to try compression. If
"TryComp" is also true, then the sender will send off
a header telling the receiver that it also wants to
try compression. In this case, compression has been
negotiated successfully and will take place when
needed.
In receive mode:
If "TryComp" has been set by the command line switch
of "-c" then the receiver will check the packet sent
by the sender. If it contains a directive to use
compression, then the receiver will set this flag
enabling compression.
Note: The "WantComp" flag is not really needed once
the compression has been negotiated successfully. The
way the receiver knows if the sender is sending a
compressed packet is by the frame end (eg ZCRCG_C as
against ZCRCG).
WantFast In send mode:
Receiver has sent a header. If in that header is the
command to try a Fast transmission then the sender
sets "WantFast" to 1. If the flag "TryFast" has been
set, then the sender will send off confirmation of
wanting a fast transmission.
In receive mode:
Not required or used in receive mode.
WantBig In send mode:
Receiver has signalled its intention to try to send
large blocks. Once set to TRUE, and providing the
sender wants to also send big blocks, the sender will
send off confirmation that we want a transmission made
up of big blocks.
In receive mode:
This is used by MpModem to regulate repositions. I use
this flag when a reposition is received to IMMEDIATELY
cut the block size down - the bigger block size is a
real killer when you have to go back and resend part
of the file.
UsingBig In send mode:
Not used as yet.
In receive mode:
Not used as yet.
UsingFast In send mode:
This flag is set to 1 (true) if the command line
switch "TryFast" is set to 1 (see above) and the
"WantFast" switch is also set to 1 (see above). Once
set to 1, "UsingFast" will make the SendByte() routine
in the Z-TX.C file ONLY escape ZDLE bytes. All other
bytes will go through without any special encoding.
In receive mode:
Set to 1 (true) if the sender wants a fast
transmission. This flag is then used in the routine
which gets the bytes to bypass some of the checks for
encoded bytes. See Z-GEN.C routine GetZDLE().
Log